package com.alibaba.citrus.cr.sales.plan.functions.salesplan.audit;

import com.alibaba.citrus.cr.sales.plan.repository.SalesPlanAuditLineRepository;
import com.alibaba.citrus.cr.sales.plan.sdo.SalesPlanAuditLineSDO;
import lombok.Getter;
import lombok.Setter;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zls
 * @description:
 * @date 2021-09-06 19:01
 */
public class SalesPlanAuditLineAbility {

    @Getter
    @Setter
    private SalesPlanAuditLineSDO salesPlanAuditLineSDO;

    @Resource
    private SalesPlanAuditLineRepository salesPlanAuditLineRepository;

    /**
     * 批量新增月度计划明细
     *
     * @param salesPlanAuditLineSDOList
     * @return
     */
    public Boolean batchCreateSalesPlanAuditLine(List<SalesPlanAuditLineSDO> salesPlanAuditLineSDOList) {
        // 批量新增现在有问题  先这样遍历
        salesPlanAuditLineSDOList.forEach(salesPlanAuditLineSDO -> {
            SalesPlanAuditLineEntity salesPlanAuditLineEntity = SalesPlanAuditLineEntity.of(salesPlanAuditLineSDO);
            String save = salesPlanAuditLineEntity.save();
        });
        return true;
//        return salesPlanAuditLineRepository.batchCreateSalesPlanAuditLine(salesPlanAuditLineSDOList);
    }
}
